package ace.module.account.core.impl.controller.rest.rpc.callback;

import ace.cmp.security.oauth2.resource.server.core.annotation.PreAuthorizeIsInternalClient;
import ace.module.account.core.impl.service.callback.auth.Oauth2AuthenticationCallbackService;
import ace.module.account.oauth2.api.model.input.IamOauth2CallbackAuthenticationInput;
import ace.module.account.oauth2.sdk.core.feign.impl.IamOauth2CallbackAuthenticationFeign;
import ace.module.common.api.annotation.ApiRemoteImplementPriority;
import ace.module.oauth2.server.api.model.dto.ext.Oauth2AceAuthResultDto;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Caspar
 */
@Tag(name = "账户oauth2-RPC-API")
@PreAuthorizeIsInternalClient
@AllArgsConstructor
@RestController
@RequestMapping(IamOauth2CallbackAuthenticationFeign.PATH)
@ApiRemoteImplementPriority
public class IamOauth2CallbackAuthenticationRpcController
    implements IamOauth2CallbackAuthenticationFeign {
  private final Oauth2AuthenticationCallbackService oauth2AuthenticationCallbackService;
  private static final String PATH = IamOauth2CallbackAuthenticationFeign.PATH;
  public static final String URL_AUTHENTICATION = PATH + "/authentication";

  @Operation(summary = "账户oauth2认证")
  @Override
  public Oauth2AceAuthResultDto authentication(IamOauth2CallbackAuthenticationInput input) {
    return this.oauth2AuthenticationCallbackService.authentication(input);
  }
}
